{template 'common/header'}
<div class="main">
    <div class="panel panel-default">

        <div class="panel-heading">结算详细信息</div>
        <div class="panel-body">
            <form action="" method="get" class="form-horizontal" role="form">

                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />

                <input type="hidden" name="id" value="{$info['id']}">
                <input type="hidden" name="shareid" value="{$shareid}">
                <input type="hidden" name="op" value="applyed">
                <input type="hidden" name="opp" value="jieyonged">
                <input type="hidden" name="m" value="eso_sale" />
                <input type="hidden" name="do" value="commission" />


                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">设置状态</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        <label class="radio-inline"><input type="radio" name="status" value="-1" {if $info['status']==-1}checked{/if}>无效</label>
                        <label class="radio-inline" ><input type="radio" name="status" value="1" {if $info['status']==1}checked{/if}>暂不处理</label>
                        <label class="radio-inline" ><input type="radio" name="status" value="2" {if $info['status']==2}checked{/if}>通过</label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">真实姓名</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        {if $user['realname']!=""} {$user['realname']}{else}未完善{/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">手机号码</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        {if $user['mobile']!=""} {$user['mobile']}{else}未完善{/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">审核时间</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        {php echo date('Y-m-d H:i:s', $info['applytime']);}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">商品名称</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        {$info['title']}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">商品价格</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        {$info['price']}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">购买数量</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        {$info['total']}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">充值佣金</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        <input type="text" class="form-control" value="{php echo ($info['commission']*$info['total'])-$commission}" readonly name="commission"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">上级分销员</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        {if $user2['realname']!=""} {$user2['realname']}{else}未完善{/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">手机号码</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        {if $user2['mobile']!=""} {$user2['mobile']}{else}未完善{/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">充值佣金</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        <input type="text" class="form-control" value="{php echo ($info['commission2']*$info['total'])-$commission2}" readonly name="commission2"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">下级分销员</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        {if $user3['realname']!=""} {$user3['realname']}{else}未完善{/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">手机号码</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        {if $user3['mobile']!=""} {$user3['mobile']}{else}未完善{/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">充值佣金</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        <input type="text" class="form-control" value="{php echo ($info['commission3']*$info['total'])-$commission3}" readonly name="commission3"/>
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">备注</label>
                    <div class="col-xs-12 col-sm-8 col-lg-9">
                        <textarea name="content" class="form-control">{$info['content']}</textarea>
                    </div>
                </div>
                <a href="{php echo $this->createWebUrl('commission', array('op'=>'applyed'))}"><input type="button" class="btn btn-primary span3" name="submit" value="返回" /></a>
                <input type="submit" class="btn btn-primary span3" name="submit" onclick="return check();" value="结算" />
                <a href="{php echo $this->createWebUrl('order',array('operation'=>'display','status'=>-1, 'shareid' => $user['id']));}"><input type="button" class="btn btn-primary span3" value="查看所有订单" /></a>
            </form>
        </div>
    </div>
	<div class="form form-horizontal">
		{if !empty($commissions)}
		<table class="table table-hover">
				<thead class="navbar-inner">
					<tr>
						<th class="row-hover" style="text-align: center;">结算佣金</th>
						<th class="row-hover" style="text-align: center;">结算时间</th>
						<th class="row-hover" style="text-align: center;">备注</th>
						
					</tr>
				</thead>
				<tbody>
					{loop $commissions $comm}
						<tr>
							<td style="text-align: center;">
								{$comm['commission']}	{if $comm['isshare']==1}(下级抽成佣金){/if}
							</td>
							<td style="text-align: center;">
								{php echo date('Y-m-d H:i:s',$comm['createtime'])}
							</td>
							<td style="text-align: center;">
								{if empty($comm['content'])}无{else}{$comm['content']}{/if}
							</td>
						</tr>
					{/loop}
				</tbody>
			</table>
		{/if}
	</div>
</div>

<script type="text/javascript">

function check(){
	var flag = false;
	if(confirm('确认结佣吗？')){
		flag = true;
	} else {
		return false;
	}

	//if({$info['commission']}*{$info['total']}-{$commission} <= 0){
	//	if(confirm('充值已符合条件，确认充值吗？')){
	//		flag = true;
	//	}else{
	//		flag = false;
	//	}
//	}
	
	return flag;
}

</script>
{template 'common/footer'}
